﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _17.initializr
{
    //初始化器：类、集合
    //与new{}匿名类的对象有关
    class Program
    {
        static void Main(string[] args)
        {
            //下面这个使用的是默认构造+初始化器
            User u1 = new User { Name = "aaa", City = "Peking" };

            //new{} 匿名类的对象
            var o = new { ID = 133, Name = "hehe" };

            //空委托
            Action a = delegate { };
            a();
        }
    }
    class User
    {
        public string Name { get; set; }
        public string City { get; set; }

        public User()
        {
        }

        public User(string name, string city)
        {
            Name = name;
            City = city;
        }

        public override string ToString()
        {
            return Name + " " + City;
        }
    }
}
